<!DOCTYPE html>

<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
	<meta name="description" content="">
	<meta name="author" content="">

	<title>商品管理</title>
	<!-- Bootstrap core CSS -->
	<link href="asserts/css/bootstrap.min.css" th:href="@{/asserts/css/bootstrap.min.css}" rel="stylesheet">

	<!-- Custom styles for this template -->
	<link href="asserts/css/dashboard.css" th:href="@{/asserts/css/dashboard.css}" rel="stylesheet">

</head>

<body>
<!-- 插入顶部部分topbar !-->
<div th:replace="commons/bar::#topBar"></div>
<div class="container-fluid">
	<div class="row">
		<!--插入左侧部分sidebar-->
		<div th:replace="commons/bar::#sidebar(activeUri='manage/admin')"></div>

		<main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
			<h2>
				<a role="button" class="btn btn-info" href="#" th:href="@{/manage/supers}">
					商品大分类管理</a>
				<a role="button" class="btn btn-info" href="#" th:href="@{/manage/subTypes}">商品小分类管理</a>
				<a role="button" class="btn btn-success" href="#" th:href="@{/manage/goods}">添加商品</a>
			</h2>
			<div class="table-responsive">
				<table class="table table-striped  table-bordered">
					<thead>
					<tr align="center">
						<th>商品名称</th>
						<th>简 介</th>
						<th>是否新品</th>
						<th>是否特价</th>
						<th>操 作</th>
					</tr>
					</thead>
					<tbody>
					<tr th:each="goods :${goodsPage.content}">
						<td th:text="${goods.goodsName}" align="center"> </td>
						<td th:text="${goods.goodsIntroduce}"> </td>
						<td th:text="${goods.isNew}==1?'是':'否'" align="center"> </td>
						<td th:text="${goods.isSale}==1?'是':'否'" align="center"></td>
						<td>
							<a type="button" class="btn btn-sm btn-primary"
							   th:href="@{/manage/goods/}+${goods.goodsId}">编辑</a>
							<a type="submit" class="btn btn-sm btn-danger"
							   th:href="@{/manage/delGoods/}+${goods.goodsId}">删除
							</a>
						</td>
					</tr>

					</tbody>
				</table>


			</div>

			<div class="row justify-content-end">
				<div class="col-4">
							<span
									th:text="|当前第 ${goodsPage.number+1} 页，
									共 ${goodsPage.totalPages} 页，
									总 ${goodsPage.totalElements} 条数据|" >
							</span>

				</div>
				<div class="col-4">
					<nav aria-label="Page navigation example">
						<ul class="pagination  " >
							<li class="page-item "
								th:class="${goodsPage.number<1}?'page-item disabled':'page-item'" >
								<a class="page-link" href="#"
								   th:href="@{/manage/admin/}+${goodsPage.number}">上一页</a>
							</li>
							<li class="page-item"
								th:each="pageNum :${#numbers.sequence(1, goodsPage.totalPages)}"
								th:class="${pageNum == goodsPage.number+1}?'page-item active':'page-item'">
								<a class="page-link" href="#"
								   th:href="@{/manage/admin/}+${pageNum}"
								   th:text="${pageNum}">
								</a>
							</li>
							<li class="page-item"
								th:class="${goodsPage.Number>goodsPage.totalPages-2}?'page-item disabled':'page-item'">
								<a class="page-link" href="#"
								   th:href="@{/manage/admin/}+${goodsPage.number+2}">下一页</a>
							</li>
						</ul>
					</nav>
				</div>
			</div>


		</main>
	</div>
</div>

<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/javascript" src="asserts/js/jquery-3.2.1.slim.min.js" th:src="@{/asserts/js/jquery-3.2.1.slim.min.js}" ></script>
<script type="text/javascript" src="asserts/js/popper.min.js" th:src="@{/asserts/js/popper.min.js}" ></script>
<script type="text/javascript" src="asserts/js/bootstrap.min.js" th:src="@{/asserts/js/bootstrap.min.js}" ></script>

<!-- Icons -->
<script type="text/javascript" src="asserts/js/feather.min.js" th:src="@{/asserts/js/feather.min.js}" ></script>
<script>
	feather.replace()
</script>

</body>

</html>